Skip to content

Conversation

@NETOIK
Copy link

@NETOIK NETOIK commented May 21, 2025

Added rule GCI1066: For logging format, prefer using %s with kwargs instead of builtin formatter "".format() or f"", that way message formatting will be deferred until it cannot be avoided.

References:
python doc about logging optimization
warning raised by pylint

@NETOIK NETOIK changed the title Logging format interpolation Logging format interpolation - TREE May 21, 2025
@NETOIK NETOIK changed the title Logging format interpolation - TREE Team TREE 2025 - Logging format interpolation May 21, 2025
@MP-Aubay MP-Aubay self-assigned this May 21, 2025
@MP-Aubay MP-Aubay changed the title Team TREE 2025 - Logging format interpolation GCI1066 [Team TREE][2025] - Logging format interpolation May 21, 2025
Copy link
Contributor

@MP-Aubay MP-Aubay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Juste move the asciidoc file and this is good to me

@NETOIK NETOIK requested a review from MP-Aubay May 21, 2025 11:23
@NETOIK NETOIK requested a review from jycr May 21, 2025 12:34
@@ -0,0 +1,51 @@
When logging with formatted string, prefer using `%s` and logging kwargs which will be deferred until it cannot be avoided, instead of immediate `.format()` of `f""` interpolation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a new test with codeCarbon to check these to uses cases :

  • one use case where "debug" mode is enabled
  • one use case where "debug" mode is disabled

@github-actions
Copy link
Contributor

This PR has been automatically marked as stale because it has no activity for 60 days.
Please add a comment if you want to keep the issue open. Thank you for your contributions!

@github-actions github-actions bot added the stale label Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants